package com.zzsy.carosshopprojects.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.king.base.adapter.ViewHolderRecyclerAdapter;
import com.king.base.adapter.holder.ViewHolder;
import com.yatoooon.screenadaptation.ScreenAdapterTools;
import com.zzsy.carosshopprojects.R;
import com.zzsy.carosshopprojects.bean.MainCardListBean;
import com.zzsy.carosshopprojects.util.DataUtil;
import com.zzsy.carosshopprojects.util.StringUtils;

import java.util.List;

public class CardSelectAdapter extends ViewHolderRecyclerAdapter<MainCardListBean.MyMainCardsBean> {

    public CardSelectAdapter(Context context, List<MainCardListBean.MyMainCardsBean> listData, int layoutId) {
        super(context, listData, layoutId);
    }

    @Override
    public View buildConvertView(LayoutInflater layoutInflater, ViewGroup parent, int viewType) {
        View view = layoutInflater.inflate(R.layout.adapter_cardselect, null);
        ScreenAdapterTools.getInstance().loadView(view);
        return view;
    }

    @Override
    public void bindViewDatas(ViewHolder helper,MainCardListBean.MyMainCardsBean bean, int positions) {
        String productName = bean.getProductName();
        if(!StringUtils.isEmpty(productName)){
            helper.setText(R.id.tv_compay_adress,productName);
        }
        if(!StringUtils.isEmpty(DataUtil.getInstance().getCompanyName())){
            helper.setText(R.id.tv_compay_adress_card,DataUtil.getInstance().getCompanyName()+"实体卡");
        }
    }

}
